import unittest


class TestCases1(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        print('所有用例的前置')

    @classmethod
    def tearDownClass(cls) -> None:
        print('所有用例的后置')

    def setUp(self) -> None:
        print('每个用例前置')

    def tearDown(self) -> None:
        print('每个用例的后置')

    def test01(self):
        """登陆用例"""
        print('执行用例1')

    def test02(self):
        """退出用例"""
        print('执行用例2')




if __name__ == '__main__':
    # 创建类加载对象
    load = unittest.TestLoader()
    # 分别加载两个类
    suit1 = load.loadTestsFromTestCase(TestCases1)
    # 放在套件里
    suits = unittest.TestSuite([suit1])

    run = unittest.TextTestRunner()
    run.run(suits)

